package com.lagou.demo.controller;

import com.lagou.demo.service.IDemoService;
import com.lagou.edu.mvcframework.annotations.LagouAutowired;
import com.lagou.edu.mvcframework.annotations.LagouController;
import com.lagou.edu.mvcframework.annotations.LagouRequestMapping;
import com.lagou.edu.mvcframework.annotations.LagouSecurity;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author 13771
 * @date 2020/8/8 0:02
 * @description
 */
@LagouController
@LagouRequestMapping("/demo")
public class DemoController {

    @LagouAutowired
    private IDemoService demoService;

    @LagouRequestMapping("/query")
    public  String query(HttpServletRequest request, HttpServletResponse response, String username){

       return demoService.get(username);
    }

    @LagouSecurity(value = {"zhangsan"})
    @LagouRequestMapping("/handle01")
    public  String handle01(HttpServletRequest request, HttpServletResponse response, String username){

        return demoService.handle01(username);
    }

    @LagouSecurity(value = {"lisi"})
    @LagouRequestMapping("/handle02")
    public  String handle02(HttpServletRequest request, HttpServletResponse response, String username){

        return demoService.handle02(username);
    }

    @LagouSecurity(value = {"zhangsan","lisi"})
    @LagouRequestMapping("/handle03")
    public  String handle03(HttpServletRequest request, HttpServletResponse response, String username){

        return demoService.handle03(username);
    }
}
